package com.jiazhong.example.project.shoppingcart.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

public interface StockMapper {

    @Update("update stock set number=number-1 where book_id=#{bookId}")
    int updateNumber1(int bookId);

    @Update("update stock set number=number+1 where book_id=#{bookId}")
    int updateNumber2(int bookId);

    @Update("update stock set number=number-${quantity} where book_id=#{bookId}")
    int updateNumber3(@Param("bookId") int bookId, @Param("quantity") int quantity);

}
